package com.macro.mall.service.impl;

import java.util.List;


import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.macro.mall.dto.BmsVolunteeRegistrationDetail;
import com.macro.mall.dto.BmsVolunteerRegistrationParam;
import com.macro.mall.mapper.BmsVolunteerRegistrationMapper;
import com.macro.mall.model.BmsVolunteerRegistration;
import com.macro.mall.service.BmsVolunteeRegistrationService;


/**
 * 观光车点位图片Service实现类
 * Created by macro on 2018/4/26.
 */
@Service
public class BmsVolunteeRegistrationServiceImpl implements BmsVolunteeRegistrationService {
    @Autowired
    BmsVolunteerRegistrationMapper bmsVolunteerRegistrationMapper;
    
    /**
     * 获取列表
     * @param
     * @return
     */
    @Override
    public List<BmsVolunteerRegistration> getList(BmsVolunteerRegistrationParam bmsVolunteerRegistrationParam) {
        BmsVolunteerRegistration bmsVolunteerRegistration = new BmsVolunteerRegistration();
        BeanUtils.copyProperties(bmsVolunteerRegistrationParam, bmsVolunteerRegistration);
        List<BmsVolunteerRegistration> list = bmsVolunteerRegistrationMapper.getListNew(bmsVolunteerRegistration);
        return list;
    }

    @Override
    public BmsVolunteerRegistration getDetail(Long id) {
        BmsVolunteerRegistration bmsVolunteerRegistration = bmsVolunteerRegistrationMapper.selectById(id);
        BmsVolunteeRegistrationDetail detail = new BmsVolunteeRegistrationDetail();
        BeanUtils.copyProperties(bmsVolunteerRegistration, detail);
        // 获取封面图
        String coverPic = bmsVolunteerRegistrationMapper.findCoverPicByActivitiesId(id);
        // 获取活动图片
        List<String> picList = bmsVolunteerRegistrationMapper.findPicListByActivitiesId(id);
        detail.setCoverPic(coverPic);
        detail.setPicList(picList);
        return detail;
    }

	@Override         
	public List<BmsVolunteerRegistration> findList(BmsVolunteerRegistrationParam bmsVolunteerRegistrationParam) {
	    BmsVolunteerRegistration bmsVolunteerRegistration = new BmsVolunteerRegistration();
	    BeanUtils.copyProperties(bmsVolunteerRegistrationParam, bmsVolunteerRegistration);

	    return bmsVolunteerRegistrationMapper.getListNew(bmsVolunteerRegistration);
	}

}
